
window.rootPath = (function (src) {
    src = document.scripts[document.scripts.length - 1].src;
    return src.substring(0, src.lastIndexOf("/") + 1);
})();
layui.config({
    base: rootPath + "layui/3lib/",
    version: true
}).extend({
    miniAdmin: "layuimini/miniAdmin", // layuimini后台扩展
    miniMenu: "layuimini/miniMenu", // layuimini菜单扩展
    miniTab: "layuimini/miniTab", // layuimini tab扩展
    miniTheme: "layuimini/miniTheme", // layuimini 主题扩展
    miniTongji: "layuimini/miniTongji", // layuimini 统计扩展
    step: 'step-lay/step', // 分步表单扩展
    xmSelect: 'xm-select/xm-select', //xm-select 下拉框
    treeTable: 'treeTable/treeTable', //table树形扩展
    tableSelect: 'tableSelect/tableSelect', // table选择扩展
    iconPickerFa: 'iconPicker/iconPickerFa', // fa图标选择扩展
    cardTable: 'cardTable/cardTable', //卡片表格拓展
    fileTable: 'fileTable/fileTable', //文件管理
    iconHhysFa: 'iconHhys/iconHhysFa', //卡片表格拓展
    echarts: 'echarts/echarts', // echarts图表扩展
    echartsTheme: 'echarts/echartsTheme', // echarts图表主题扩展
    eleTree: 'eleTree/eleTree', // eleTree树
    tinymce: 'layui-tinymce/tinymce/tinymce', // 富文本
    opTable: 'opTable/opTable', // 小手掌表格
    tableMerge: 'tableMerge/tableMerge', // 表格合并
    sliderVerify: 'sliderVerify/sliderVerify', // 滑块
    pinyin: "pinyin/pinyin", //  layui 的 拼音
    formX: "formX/formX", //表单验证扩展
    fileManager: "fileManager/fileManager", //文件管理器
    contextMenu: "contextMenu/contextMenu", //鼠标右键
    numberInput: "numberInput/js/index", //数字输入框
    message: "message/message", //消息通知
    count: "count/count",
    topBar: "topBar/topBar",
    nixue: 'nixue', // 自定义协议
});
/**注册支持当前结果的路由规则 */
layui.AddRoute = function (isindex = true) {
    if (parent.layui.BaseNx && parent.layui.BaseNx.IsAdmin) {
        layui.BaseNx = parent.layui.nixue;
        layui.BaseNx.IsAdmin = true;
        layui.BaseNx.AdminLayers += (parent.layui.BaseNx.AdminLayers + 1);
        if (layui.nixue) {
            layui.nixue.BaseNixue = layui.BaseNx;
        }
        return true;
    } else if (parent.layui.nixue && parent.layui.nixue.IsAdmin) {
        layui.BaseNx = parent.layui.nixue;
        return true;
    } else if (isindex) {
        layer.alert("非法访问！", { yes: close, end: close });
        function close() { location = location.origin; }
        return false;
    }
    return true;
}